package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsIncidentsAgingReportPageUtil extends SeleniumPageUtil{
	public final static By RIAR_SPAN_HEADER = By.id("ctl44_IncidentAgingReport_Header_lblHeader");
	
	public final static By RIAR_IMG_REPORT_PREFERENCES = By.id("ctl44_IncidentAgingReport_Header_imgPreferences");
	public final static By RIAR_IMG_EXPORT = By.id("ctl44_IncidentAgingReport_Header_imgExcelExport");
	public final static By RIAR_A_SCOPE = By.xpath("//*[@id='d0e9b698-c0b6-494c-9859-047cc9fa0e57']/a");
	public final static By RIAR_LI_MY_FE_TEAM = By.name("My FE Team");
	public final static By RIAR_LI_MY_WAREHOUSES = By.name("My Warehouses");
	public final static By RIAR_LI_MY_WAREHOUSES_BY_CUSTOMER = By.name("My Warehouses By Customer");
	public final static By RIAR_LI_ALL_INCIDENTS = By.name("All Incidents");
	
	public final static By RIAR_TD_PAGE = By.xpath("//*[@id='agingReport']/table[2]/tbody/tr/td[1]");
	public final static By RIAR_SPAN_PAGE_START_NO = By.id("ctl44_IncidentAgingReport_PagingTop_lblPagingPageNumber");
	public final static By RIAR_TD_OF = By.xpath("//*[@id='agingReport']/table[2]/tbody/tr/td[3]");
	public final static By RIAR_SPAN_PAGE_COUNT = By.id("ctl44_IncidentAgingReport_PagingTop_lblPagingPageCount");
	
	public final static By RIAR_INPUT_FIRST = By.id("ctl44_IncidentAgingReport_PagingTop_imgFirst");
	public final static By RIAR_INPUT_PREVIOUS = By.id("ctl44_IncidentAgingReport_PagingTop_imgPrevious");
	public final static By RIAR_INPUT_NEXT = By.id("ctl44_IncidentAgingReport_PagingTop_imgNext");
	public final static By RIAR_INPUT_LAST = By.id("ctl44_IncidentAgingReport_PagingTop_imgLast");
	
	public final static By RIAR_TH_0_3 = By.id("ctl44_IncidentAgingReport_sort_2\r\n          ");
	public final static By RIAR_TH_4_7 = By.id("ctl44_IncidentAgingReport_sort_3\r\n          ");
	public final static By RIAR_TH_8_14 = By.id("ctl44_IncidentAgingReport_sort_4\r\n          ");
	public final static By RIAR_TH_15_21 = By.id("ctl44_IncidentAgingReport_sort_5\r\n          ");
	public final static By RIAR_TH_OVER21 = By.id("ctl44_IncidentAgingReport_sort_6\r\n          ");
	public final static By RIAR_TH_TOTAL = By.id("ctl44_IncidentAgingReport_sort_7\r\n          ");
	
	public static void enterReportsIncidentsAgingReportPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_AGING_REPORT));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RIAR_A_SCOPE, RIAR_IMG_EXPORT, RIAR_INPUT_FIRST, RIAR_INPUT_PREVIOUS, RIAR_INPUT_NEXT,RIAR_INPUT_LAST, 
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_A_SCOPE));
//		SmsSeleniumUtil.isDisplayed(SmsSeleniumUtil.findElement(RIAR_IMG_REPORT_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RIAR_INPUT_LAST));
	}
}